package com.stu.common.compate;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

/**
 * @author MI
 * @ClassName Cus.java
 * @createTime 2022年01月21日 11:15:00
 */
@Slf4j
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Cus {
    private String cusCode;
    private String cusName;

    @Override
    public boolean equals(Object o) {
        log.info("Cus.equals");
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Cus cus = (Cus) o;
        return new EqualsBuilder().append(cusCode, cus.cusCode).append(cusName, cus.cusName).isEquals();
    }

    @Override
    public int hashCode() {
        log.info("Cus.hashCode");
        return new HashCodeBuilder(17, 37).append(cusCode).append(cusName).toHashCode();
    }

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this, ToStringStyle.NO_CLASS_NAME_STYLE);
    }
}
